<a target="blank" class="printOrder btn-primary" href="<?php echo base_url()?>order/printOrder/<?php echo $order->OrderID?>">
	<i class="fa fa-print"></i> 
	Print Order</a>
<div class="clear"></div>
<h2 class="headBox"><i class="fa fa-shopping-cart"></i> <?php echo $order->OrderID?></h2>
<div class="docHeader">
	
<form id="myForm2" method="post" action="<?php echo $current?>viewcart" class="form-horizontal" role="form">
	
	<div class="form-group">
	<input type="hidden" name="OrderID" value="<?php echo $order->OrderID?>" />
	<label for="CustName" class="col-sm-2 control-label">
		<i class="fa fa-user"></i> 
		ชื่อลูกค้า</label>
    <div class="col-sm-10">
     <span style="line-height:20px"><?php echo $order->CustName?></span>
    </div>
   </div>
   

   
   
   <div class="form-group">
	
	<label for="CustName" class="col-sm-2 control-label">
		<i class="fa fa-home"></i> 
		ที่อยู่</label>
    <div class="col-sm-10">
     <span style="line-height:20px"><?php echo $order->Address1?></span>
    </div>
   </div>
   
   
   <div class="form-group">
	
	<label for="CustName" class="col-sm-2 control-label">
		<i class="fa fa-tag"></i> 
		ประเภทลูกค้า</label>
    <div class="col-sm-10">
     <span style="line-height:20px"><?php echo $order->CustType?></span>
    </div>
   </div>
   
   <div class="form-group">
	
	<label for="CustName" class="col-sm-2 control-label">
		<i class="fa fa-info-circle"></i> 
		ประเภทการชำระเงิน</label>
    <div class="col-sm-10">
     <span style="line-height:20px"><?php echo $order->Payment?></span>
    </div>
   </div>
   <div class="form-group">
	
	<label for="CustName" class="col-sm-2 control-label">
		<i class="fa fa-info-circle"></i> 
		สถานะการชำระเงิน</label>
    <div class="col-sm-10">
     <span style="line-height:20px"><?php echo ($order->PaymentStatus=="Y") ? "ชำระแล้ว" : "ยังชำระแล้ว"?></span>
    </div>
   </div>
   
   <div class="form-group">
	
	<label for="CustName" class="col-sm-2 control-label">
		<i class="fa fa-info-circle"></i> 
		ประเภทภาษี</label>
    <div class="col-sm-10">
     <span style="line-height:20px"><?php echo $order->VatType?></span>
    </div>
   </div>

</form>
</div>

<?
if(count($order->orderDetail) > 0 ){
?>
<table cellpadding="6" cellspacing="1"  border="0" class="myTable table2">

<tr>
  <th style="width:40%">สินค้า</th>
  <th style="text-align:right;width:10%">ราคาต่อหน่วย</th>
  <th style="text-align:center;width:10%">หน่วย</th>
  
  
  <th style="text-align:center;width:10%">จำนวน</th>
  <th style="text-align:right;width:10%">ราคารวม</th>
  
  
</tr>

<?php $i = 1; ?>
<?
$allDiscount = 0;
$totalSale = 0;
$totalPremium = 0;
?>
<?php foreach ($order->orderDetail as $in=>$val): ?>
	
	<?
	$pName = $val->pName;
	$class = "";
	if($val->IsSaleProduct == "TANN"){
		$class = "line-preimum";
		$pName = $pName."<br>(สินค้าแถม)";	
	}
	
	?>
	<tr class="<?php echo $class?>">
	  <td style="width:40%"><?php echo $val->pID ?><br />
		<?php echo $pName;//$val->pName ?></td>
	
	 <td style="text-align:right;width:60px">
	  		<div style="width:60px;float:right;float:right;"><?php echo $this->cart->format_number($val->Price); ?></div>
	  </td>
		
		<td style="text-align:right;width:90px">
	  	<div style="width:90px;float:right;"><?php echo number_format($val->sendQty)?></div>
	  </td>
	  
		<td style="width:10%;text-align: right;"><?php echo converUnitView($val)?></td>
	  <td style="text-align:right;width:90px">
	  	<div style="width:90px;float:right;"><?php echo $this->cart->format_number($val->PriceAfterDisc); ?></div>
	  </td>
	  
	  
	  
	  
	</tr>

<?php $i++; ?>

<?php endforeach; ?>

<tr>
  <td colspan="3"> </td>
  <td class="right"><strong>ราคารวม</strong></td>
  
  <td class="right" style="text-align: right"><?php echo $this->cart->format_number($order->TotalAmount); ?></td>
</tr>
<tr>
  <td colspan="3"> </td>
  <td class="right"><strong>ราคาของแถม</strong></td>
  
  <td class="right" style="text-align: right"><?php echo $this->cart->format_number($order->PremiumPrice); ?></td>
</tr>
<tr>
  <td colspan="3"> </td>
  <td class="right"><strong>ส่วนลด</strong></td>
  <td class="right" style="text-align: right"><?php echo $this->cart->format_number($order->Discount); ?></td>
</tr>
<tr>
  <td colspan="3"> </td>
  <td class="right"><strong>สุทธิ</strong></td>
  <td class="right" style="text-align: right"><?php echo $this->cart->format_number($order->PriceAfterDisc); ?></td>
</tr>
<tr>
  <td colspan="5" class="right" style="text-align: right;font-weight:bold">ข้อมูลการชำระเงิน</td>
</tr>
<tr>
  <td colspan="3"> </td>
  <td class="right"><strong>ชำระแล้ว</strong></td>
  <td class="right" style="text-align: right"><?php echo $this->cart->format_number($order->PricePaid); ?></td>
</tr>
<tr>
  <td colspan="3"> </td>
  <td class="right"><strong>คงเหลือชำระ</strong></td>
  <td class="right" style="text-align: right"><?php echo $this->cart->format_number($order->PriceAfterDisc - $order->PricePaid); ?></td>
</tr>
</table>
<?
}
?>
<?
if(!empty($DI)){
?>
	<h2 class="headSection">ใบจัดส่ง</h2>
	<table cellpadding="6" cellspacing="1"  border="0" class="myTable table2">

<tr>
  <th style="width:20%">DINO</th>
  <th style="text-align:right;width:10%">มูลค่า</th>
  <th style="text-align:center;width:10%">ส่วนลด</th>
  <th style="text-align:right;width:10%">สุทธิ</th>
  <th style="text-align:right;width:10%">สถานะ</th>
  <th style="text-align:right;width:10%">วันที่จัดส่ง</th>
  <th style="text-align:center;width:10%">สถานะการจัดส่ง</th>
  <th style="text-align:right;width:10%">สถานะการชำระเงิน</th>
  <th style="text-align:right;width:10%">ดูข้อมูล</th>
  
  
</tr>
	<?
	foreach($DI as $in=>$val){
	?>
		<tr>
			<td><?php echo $val->DINO?></td>
			<td align="right"><?php echo number_format($val->TotalAmount) ?></td>
			<td align="right"><?php echo number_format($val->Discount) ?></td>
			<td align="right"><?php echo number_format($val->NetAmount) ?></td>
			<td align="center"><?php echo $val->DIStatus?></td>
			<td align="center"><?php echo $val->ShipDate?></td>
			<td align="center"><?php echo $val->SendStatus?></td>
			<td align="center"><?php echo $val->PaymentStatus?></td>
			<td align="center"><a href="<?php echo $current?>viewDI/?dino=<?php echo $val->DINO?>"><i class="fa fa-truck"></i></a></td>
			
		</tr>
	<?
	}
	?>
	</table>
<?
}
?>
<br /> 
